﻿$(function () {
    let dateStr,timeStr,hospitalName;
     // 加载医院名称
     axios.get(`/api/his-appoint/hospital-name`)
                        .then(res => {
                            if (res.data.code === 0) {
                                $('#hospital-container').text(res.data.data.hospitalName);
                            }
                        });

     axios.get('/api/self-service/get-client-ip')
            .then(res=>{
                if(res.data.code===0){
                    $('#ipv4').text(res.data.data.ip);
                }
            })

    const refreshDateTime=()=>{
        let dateTime = new Date();
        let dayOfWeek;
        let now= dayjs();
        switch (now.day()) {
                    case 0:
                        dayOfWeek = '星期日'
                        break;
                    case 1:
                        dayOfWeek = '星期一'
                        break;
                    case 2:
                        dayOfWeek = '星期二'
                        break;
                    case 3:
                        dayOfWeek = '星期三'
                        break;
                    case 4:
                        dayOfWeek = '星期四'
                        break;
                    case 5:
                        dayOfWeek = '星期五'
                        break;
                    case 6:
                        dayOfWeek = '星期六'
                        break;
        }
        $('.time-container .date').text(`${dayjs(dateTime).format('YYYY-MM-DD')} ${dayOfWeek}`);
        $('.time-container .time .time-inner').text(dayjs(dateTime).format('HH:mm:ss'));
    };
    setInterval(refreshDateTime, 1000);
});